package com.miaomiao.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {

    private Integer code;
    private String msg;
    private Object data;

    public Result(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public static Result success(Object data) {
        return new Result(200,data);
    }
    public static Result success(String msg) {
        return new Result(200,msg);
    }

    public static Result success(String msg,Object data) {
        return new Result(200,msg,data);
    }

    public static Result error(Integer code, String msg) {
        return new Result(code,msg);
    }

    public static Result error(Integer code, String msg, Object data) {
        return new Result(code,msg,data);
    }

    public static Result error(String msg){
        return new Result(500,msg);
    }
}
